-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci: move pre-commit checks to CI #893
Conversation
Hmm, can't quite figure it out but now when I run |
.github/workflows/ci.yml
Outdated
node-version: 16 | ||
cache: 'yarn' | ||
- run: | | ||
yarn install |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think ideally this action can run very quickly, and fail early (to prevent other jobs from running).
Maybe we could use npx
here (rather than yarn installing everything for the repo).
const generator = tsj.createGenerator({ | ||
path: path.resolve(__dirname, "../src/index.ts"), | ||
tsconfig: path.resolve(__dirname, "../tsconfig.json"), | ||
skipTypeCheck: true, | ||
encodeRefs: false, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Running ts-json-schema-generator
from the command line multiple times is unnecessarily expensive, since it needs to run TS and parse the AST each time for the whole Gosling code base. We can re-use the same schema generator for each of our schemas in this single script.
Ah, actually I see what's going on. We needed to use Everything is working as it should now, it's just this action is extremely slow because:
In theory, this "Lint Repo" job should be extremely fast and fail early since it's so minimal, but as it stands it takes the longest out of all the other jobs (including tests and building the editor). Not sure how to proceed because although this is kind of nicer than pre-commit hooks, its very costly in CI. EDIT: I guess 2.5 minutes isn't horrible, but reducing the size of the repo and making the yarn install much faster would probably make the job take seconds. |
package.json
Outdated
@@ -155,7 +153,6 @@ | |||
}, | |||
"husky": { | |||
"hooks": { | |||
"pre-commit": "run-p changelog schema schema-higlass schema-theme schema-template format && git add .", | |||
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, since our "git flow" is squash & merge PRs, idk if it makes sense to lint every commit for conventional commits.
Instead, something like a GitHub action to lint the PR title would probably make more sense
Not sure if either of you have thoughts on this: @etowahadams @sehilyi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would make sense to use the semantic-pull-request
you shared and remove the commitlint
we use for every commit.
We were using another semantic PR which is deprecated and does not work anymore. We were using commitlit
to handle a case where there is only one commit in a PR because in this case GitHub used the commit message and ignored the PR title. But, using PR title by default is now supported, so I don't think we need commitlint
anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree! No need to have every conventional commit name be linted.
@@ -26,9 +26,11 @@ jobs: | |||
runs-on: ubuntu-latest | |||
steps: | |||
- uses: actions/checkout@v3 | |||
with: | |||
fetch-depth: 0 | |||
- uses: actions/setup-node@v3 | |||
with: | |||
node-version: 16 | |||
- run: npx changelogithub |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw this action was added in #881. This action also won't work unless you set fetch-depth: 0
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, got it! Thanks for finding this
Regarding the costly CI, would the CI speed be more reasonable if we remove |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am open to merging this unless this will likely surpass the available usage of GitHub actions.
I don't think we are likely to surpass available usage of GitHub actions (famous last words), but it does mean that currently it will take CI longer to pass (which is annoying for PRs). I like the idea of only running the |
Should be all good to merge. The main change now is that when you bump the version The release "flow" is as described in the conventional-changelog docs: https://github.com/conventional-changelog/conventional-changelog/blob/master/packages/conventional-changelog-cli/README.md#with-npm-version concretely,
|
Implements #877 (comment)
Change List
scripts/generate-schemas.mjs
)Checklist